import java.awt.Dimension;
import java.util.HashSet;
import java.util.Random;
import java.util.Scanner;
import java.util.Set;

import edu.uci.ics.jung.algorithms.layout.CircleLayout;
import edu.uci.ics.jung.algorithms.layout.Layout;
import edu.uci.ics.jung.graph.Graph;
import edu.uci.ics.jung.graph.SparseMultigraph;
import edu.uci.ics.jung.visualization.BasicVisualizationServer;
import edu.uci.ics.jung.visualization.decorators.ToStringLabeller;

import p2p.gui.P2PWindow;
import p2p.logic.connection.client.Client;
import p2p.logic.log.Logger;
import p2p.peer.Peer;
import p2p.simulation.JungAdapter;
import p2p.simulation.PeerManager;
import p2p.simulation.Simulation;


public class MainTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		P2PWindow window = P2PWindow.getInstance();

		Simulation.getInstance().start();

		try{
			// Wait until simulation ends
			Thread.sleep(10000);
			
		}catch(Exception e){
			e.printStackTrace();
		}
	
		JungAdapter adapter = new JungAdapter(PeerManager.getInstance().getPeerList());
		P2PWindow.getInstance().setGraphVisualisation(adapter.getVisualisation());
		Scanner scanner = new Scanner(System.in);
		PeerManager m = PeerManager.getInstance();
		while(true){
			System.out.println("Port: ");
			PeerManager.getInstance().leaveClient(scanner.nextLine());
		}
	}

}
